package Demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 87111
 * Date: 2025-05-25
 * Time: 11:13
 */
public class Test1 {
    public static void swap(Test2 test1,Test2 test2) {
        int swp = test1.a;
        test1.a = test2.a;
        test2.a = swp;
    }

    public static void main(String[] args) {
        //交换两个数
        Test2 test1 = new Test2();
        test1.a = 10;
        Test2 test2 = new Test2();
        test2.a = 20;
        System.out.println(test1.a + "," + test2.a);
        swap(test1,test2);
        System.out.println(test1.a + "," + test2.a);
    }
}
